<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var num = parseInt(prompt("请输入一个数字来判断是否是质数"));
    for(var i = 2;i < num ;i++){
        if(num % i == 0){
            alert("不是质数");
            break;
        }
        if(i == num - 1){
            alert("是质数")
        }
    }
</script>
</html>